package lhdx15;

public class Disk {
    private String drive;
    private int diskSize;
    private int j=0;
    Software[] so=new Software[0];

    public int getJ() {
        return j;
    }

    public void setJ(int j) {
        this.j = j;
    }

    public String getDrive() {
        return drive;
    }

    public void setDrive(String drive) {
        this.drive = drive;
    }
    public int getDiskSize() {
        return diskSize;
    }

    public void setDiskSize(int diskSize) {
        this.diskSize = diskSize;
    }

    public Disk(String drive, int diskSize) {
        this.drive = drive;
        this.diskSize = diskSize;

    }
    public void add(Software s){
        if (j>=so.length){
            Software[] so1=new Software[so.length+100];
            System.arraycopy(so,0,so1,0,so.length);
            so=so1;
            System.out.println("已扩容！");
        }
        so[j++]=s;
    }
    public Disk(){

    }
    public Disk(int j){
        this.j=j;
    }

    @Override
    public String toString() {
        return "盘符：" + drive + '\'' +
                ",磁盘大小：" + diskSize ;
    }
}
